<template>
	<!-- 我的钱包 -->
	<view class="share_de1" v-if="userinfo">
		<image src="/static/my/afd97570dd235ea1983e93dcf3a9f0f.png" class="topc"></image>
		<view class="nav">
			<view class="nav_tp">
				好友矿石奖励
				<view class="dea" @click="xq()">
					详情
					<image class="img" src="/static/rig.png"></image>
				</view>
			</view>
			
			<view class="nav_cnt">
				直邀好友玩蚂蚁矿山，你可以获得矿石奖励
			</view>
			<view class="nav_bnt" style="padding-bottom: 120rpx;">
				<view class="lef">
					<view class="top">{{userinfo.day_num}}个</view>
					<view class="bot">
						今日奖励
					</view>
				</view>
				<view class="lef" style="margin-left:15%;">
					<view class="top">{{userinfo.his_num}}个</view>
					<view class="bot">
						累计奖励
					</view>
				</view>
				
				<view class="lef">
					<view class="top">{{userinfo.his_day}}次</view>
					<view class="bot">
						好友参与次数
					</view>
				</view>
			</view>
		</view>
		
		<view class="nav_s">
			<view class="nav_tp" @click="xq1()">
				我的好友：{{userinfo.ch_num}}人
				<view class="dea"  >
					<image class="img" src="/static/rig.png"></image>
				</view>
			</view>
			<view class="bnt" @click="yaoqing()">
				邀请好友
			</view>
		</view>
		
		<view class="nav_a"  v-if="userinfo.par_user">
			<view class="nav_tp">
				我的邀请人
				<view class="dea">
					联系TA
					<image class="img" src="/static/rig.png"></image>
				</view>
			</view>
			<view class="bnt">
				
				
				<view class="act">
					<image class="img" style="border-radius: 5em;" :src="userinfo.par_user.avatar?userinfo.par_user.avatar:'/static/logo.png'"></image>
				</view>
				<view class="msg">
					<view class="tc">
						{{userinfo.par_user.nickname}}
					</view>
					<view class="yq">
						他邀请了{{userinfo.par_user.ch_num}}人
					</view>
				</view>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import noData from '@/components/noData.vue'
	export default {
		components: {
			noData
		},
		data() {
			return {
				pageIndex: 1, // 当前页
				has_more: false, // 是否有更多
				loadding: false,
				pullUpOn: true,
				list: [],
				money:'',
				type:0,
				
				page: 1,
				total: 0,
				list: [],
				userinfo:null,
			}
		},
		onShow() {
			this.get_userinfo();
		},
		onReachBottom: function() {
		
		},
		computed: {
			noDataShow() {
				return !this.list.length
			}
		},
		methods: {
			get_userinfo(){
				let that = this;
				uni.showLoading({ title: '正在加载', mask: true });
				uni.hideLoading();
				that.$api.request('/api/user/get_info2', {},uni.getStorageSync('token'), function(res) {
								uni.hideLoading()
								if (res.code === 1) {
									that.userinfo = res.data
								} else {
									uni.showToast({
										title: res.msg,
										icon: 'none'
									})
								}
				});
				
			},
			xq1(){
				console.log(111111111)
				
				uni.navigateTo({
					url: '/pages/share/share_dea'
				});
			},
			xq(){
				
				uni.navigateTo({
					url: '/pages/my/my_log?type=7'
				});
			},
			yaoqing(){
				uni.navigateTo({
					url: '/pages/share/share'
				});
			},
			getInfo(){
				uni.showLoading({
					title: '加载中...'
				})
				this.$http.get(this.$api.userWallet, {
					page: this.pageIndex,
					size: 10
				}).then(res => {
					uni.hideLoading()
					this.loadding = false;
					if (res.code === 1) {
						this.money = res.data.money
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			},
			getList() { // 获取明细列表
				
				uni.showLoading({ title: '正在加载', mask: true });
				var _this = this;
				_this.$api.request('/api/user/topups', {page:this.page,	type:this.type}, uni.getStorageSync('token'), function(res) {
					uni.hideLoading();
					if (res.code == 1) {
						_this.total = res.data.total;
						_this.score = res.data.score
						if (_this.page == 1) {
							_this.list = res.data.data;
						} else {
							_this.list = _this.list.concat(res.data.data);
						}
					}
					uni.hideLoading();
				});
				
			}
			
		}
	}
</script>

<style lang="scss">
	page{
		background: #f7f7f7;
	}
	
	.share_de1{
		
		.topc{
			height: 340rpx;
			width: 100%;
		}
		
		.nav{
			border-radius: 0.4em;
			width: 94%;
			margin-left: 3%;
			background: #fff;
			
			.nav_tp{
				padding-top: 25rpx;
				width: 94%;
				margin-left: 3%;
				font-size: 34rpx;
				font-weight: 700;
				.dea{
					color: #999;
					font-weight: 500;
					font-size: 22rpx;
					float: right;
					
					.img{
						width:25rpx;
						height: 25rpx;
						border-radius: 5em;
					}
				}
			}
			.nav_cnt{
				width: 94%;
				margin-left: 3%;
				font-size: 22rpx;
				color: #999;
				margin-top: 10rpx;
			}
			
			.nav_bnt{
				height: 40px;
				width: 100%;
				margin-top: 20rpx;
				padding-bottom: 23rpx;
				.lef{
					margin-left: 3%;
					float: left;
					.top{
						font-size: 34rpx;
						font-weight: 700;
					}
					.bot{
						margin-top: 6rpx;
						font-size: 24rpx;
						color: #999;
					}
					&:last-child{
						margin-left: 15%;
					}
				}
			}
		}
		
		.nav_s{
			margin-top: 10px;
			padding-bottom:25rpx;
			border-radius: 0.4em;
			width: 94%;
			margin-left: 3%;
			background: #fff;
			.nav_tp{
				padding-top: 25rpx;
				width: 94%;
				margin-left: 3%;
				font-size: 30rpx;
				font-weight: 700;
				.dea{
					color: #999;
					font-size: 18rpx;
					float: right;
					.img{
						width:25rpx;
						height: 25rpx;
							border-radius: 5em;
					}
				}
			}
			.bnt{
				background: #333;
				width: 92%;
				margin-left: 4%;
				height: 90rpx;
				line-height: 90rpx;
				text-align: center;
				color: #fff;
				margin-top: 30rpx;
				border-radius: 0.3em;
				font-size: 26rpx;
			
			}
		}
		.nav_a{
			margin-top: 10px;
			padding-bottom:25rpx;
			border-radius: 0.4em;
			width: 94%;
			margin-left: 3%;
			background: #fff;
			.nav_tp{
				padding-top: 25rpx;
				width: 94%;
				margin-left: 3%;
				font-size: 30rpx;
				font-weight: 700;
				.dea{
					color: #999;
					font-size: 18rpx;
					float: right;
					.img{
						width:25rpx;
						height: 25rpx;
					}
				}
			}
			.bnt{
				width: 92%;
				margin-left: 4%;
				height: 100rpx;
				margin-top: 30rpx;
				border-radius: 0.3em;
				font-size: 26rpx;
				.act{
					float: left;
					.img{
						width: 70rpx;
						height: 70rpx;
						border: 20em;
					}
				}
				.msg{
					
					margin-left: 20rpx;
					float: left;
					.tc{
						font-size: 28rpx;
						font-weight: 700;
					}
					.yq{
						font-size: 22rpx;
						color: #999;
						margin-top: 5rpx;
					}
				}
			}
			
		}
	}
	
	.head-box {
		position: relative;
		z-index: 99;
		width: 100%;
		padding: 0 30rpx 60rpx;
		box-sizing: border-box;

		background-repeat: no-repeat;
		background-position: top center;
		background-size: 100%;
	}
</style>
